package classes;
import java.util.Vector;


public class Iterator< T >
{
	private Vector< T > objetos;
	private int index;
	
	public Iterator( Vector< T > objetos)
	{
		this.objetos = objetos;
		this.index = 0;
	}
	
	public boolean hasNext()
	{
		boolean ret;
		
		ret = index < objetos.size();
		
		return ret;
	}
	
	public boolean hasPrevious()
	{
		boolean ret;
		
		ret = index > 0;
		
		return ret;
	}

	public T next()
	{
		T ret;
		
		ret = objetos.get( index++ );
		
		return ret;
	}
	
	public T previous()
	{
		T ret;
		
		ret = objetos.get( index-- );
		
		return ret;
	}
	
	public T first()
	{
		T ret;
		
		index = 0;
		ret = objetos.get( index );
		
		return ret;
	}
	
	public T last()
	{
		T ret;
		
		index = objetos.size() - 1;
		ret = objetos.get( index );
	
		return ret;
	}
	
	public Vector< T > toVector()
	{
		return this.objetos;
	}
}
